/**
 * 
 */
package ui.model;

import java.util.ArrayList;

import javax.swing.DefaultComboBoxModel;

import exceptions.*;

import appControll.AppController;

import model.Section;

/**
 * @author Anthares & Hennek
 *
 */
public class SectionComboBoxModel extends DefaultComboBoxModel {
	private ArrayList<Section> sectList;
	private AppController app = AppController.getUniqueInstance();
	
	/**
	 * @throws PasIdentificationException 
	 * @throws DatabaseErrorException 
	 * 
	 */
	public SectionComboBoxModel() throws PasIdentificationException, DatabaseErrorException {
		sectList = app.getAllSection();
		for(Section s : sectList){
			this.addElement(s.getLibelle());
		}
	}
	public Section getSection(int i){
		return sectList.get(i);
	}
	public void addSection(Section s){
		sectList.add(s);
		this.addElement(s.getLibelle());
	}
}
